<?php
$this->breadcrumbs=array(
	Yii::t('yii','Message')=>array('/msg'),
	Yii::t('yii','Send')
);


?>

<h1>Изпрати съобщение</h1>

<?php
if(Yii::app()->user->hasFlash('model')) {
	Yii::app()->user->flash('model', array('<div class="confirmation">', '</div>'));
	return;
}
?>

<div class="yiiForm">

<?php 
$JFV=Yii::app()->jformvalidate;
$JFV->setOptions(array(
		'errorElement'=> 'div',
		'errorClass' => 'invalid',
        ));


echo $JFV->form(); 
?> 

    <?php echo Html::errorSummary($msg); ?>

    <div class="simple">
        <?php echo Html::activeLabel($msg,'name'); ?>
        <?php echo $JFV->activeTextField($msg,'name'); ?>
    </div>
    <div class="simple">
        <?php echo Html::activeLabel($msg,'subject'); ?>
        <?php echo $JFV->activeTextField($msg,'subject',array('size'=>45,'maxlength'=>128)); ?>
    </div>
    <div class="simple">
        <?php echo Html::activeLabel($msg,'msg'); ?>
        <?php echo $JFV->activeTextArea($msg,'msg',array('rows'=>6, 'cols'=>50)); ?>
    </div>

    <div class="action">
        <?php echo Html::submitButton(Yii::t('yii','Submit'),array('class'=>'submit')); ?>
    </div>

    <?php echo $JFV->endForm(); ?>

</div><!-- yiiForm -->


<script type="text/javascript">
$("form").bind("submit", function() { return false; });

$('.submit').bind('click', function () {
  jQuery.ajax({
'type':'POST',
'url': jQuery(this).parents("form").attr("action"),
'cache':false,
'data':jQuery(this).parents("form").serialize(),
'success':function(html){
jQuery("#content").html(html)}
});
  
  return false;
});

</script>

